#pragma once
#include "Data.h"
#include "DString.h"
#include "SString.h"
#include "TArray.h"
#include "TMap.h"


template< typename T> struct TypeTraits
{
	//static bool		IsPrimitiveType() { return 1;}
};
/*
template<> struct TypeTraits< bool>
{
	static EDataType	Type() { return Data_Bool;}
};
*/





// hash functions
/*
string hash function
*/
u32_t _strHash( const as_char_t* str, s32_t mod );

inline u32_t _hashKey( const s32_t val, s32_t mod )
{
	return val%mod;
}

inline u32_t _hashKey( const u32_t val , s32_t mod)
{
	return val%mod;
}

inline u32_t _hashKey( const char* str, s32_t mod)
{
	return _strHash( str, mod);
}

inline u32_t _hashKey( const DString& str, s32_t mod)
{
	return _strHash( (const char*)str, mod);
}

inline u32_t _hashKey( const SString& name, s32_t mod)
{
	return _strHash( (const char*)name, mod);
}

/*
min & max
*/
template< class T > inline T Max( const T a, const T b )
{
	return (a>=b) ? a : b;
}

template< class T > inline T Min( const T a, const T b )
{
	return (a<=b) ? a : b;
}

/*
char
*/
inline as_char_t _toUpper( char c )
{
	return (c<'a' || c>'z') ? (c) : (c+'A'-'a');
}
inline as_char_t _toLower( char c )
{
	return (c<'A' || c>'Z') ? (c) : (c+'a'-'A');
}
inline bool _isUpper( char c )
{
	return (c>='A' && c<='Z');
}
inline bool _isLower( char c )
{
	return (c>='a' && c<='z');
}
